package org.red.checkSystem.service.impl.check;
import org.red.checkSystem.pojo.Article;
import org.red.checkSystem.service.check.checkAutoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.red.checkSystem.mapper.articleMapper;

import java.util.Date;

@Service
public class checkAutoServiceImpl implements checkAutoService{
    @Autowired
    articleMapper articleMapper;
    @Override
    public String checkAuto(Article article) {
        String content = article.getContent();
        if(content.contains("违法内容") ){
            article.setState("不通过");
            article.setAdmin("自动审核");
            article.setChecktime(new Date());
            return "error";
        }else article.setState("待审核");
        articleMapper.updateById(article);
        return "success";
    }
}
